<?php
$q=$_GET["q"];
$hint='';
if($q!="")
{
include_once ("../Login/databaseconnection.php");
require_once ("../Login/config.php");
$id=$q;
$hint="<br/><font color='black'>";

$resultpp= mysql_query("SELECT * FROM lab Where Lab_Id='$id'");
if($rowpp = mysql_fetch_array($resultpp))
{
$L_Type=$rowpp['Lab_Type'];
if($L_Type!="")
{
$hint=$hint."<br/>To view all <a href='".$basedir."/Lab/SearchLab.php?action=lab&lt=".$L_Type."' class='searchlinks'>".$L_Type."</a>s' details<br/>";
}
}
$resultds = mysql_query("SELECT DISTINCT(School_Id) FROM lab Where Lab_Id='$id'");
while($rowds= mysql_fetch_array($resultds))
{
$Sc=$rowds['School_Id'];
$hint=$hint."<br/>To view all ".$q." Labs' details of ";
$resultsc = mysql_query("SELECT * FROM school Where School_Id='$Sc'");
if($rowsc= mysql_fetch_array($resultsc))
{
$hint=$hint.'<a href="'.$basedir.'/Lab/SearchLab.php?action=school&s='.$rowds['School_Id'].'&l='.$id.'" class="searchlinks">'.$rowsc['Name'].' in '.$rowsc['Address'].'</a><br/>';
}
}
$resultdy = mysql_query("SELECT * FROM lab Where Lab_Id='$id'");
while($rowdy= mysql_fetch_array($resultdy))
{
$hint=$hint."<br/>To view all ".$q." Labs' details their Account number as ";
$hint=$hint.'<a href="'.$basedir.'/Lab/SearchLab.php?action=accountnumber&an='.$rowdy['Account_Number'].'" class="searchlinks">'.$rowdy['Account_Number'].'</a><br/>';
$hint=$hint."<br/>To view all ".$q." Labs' details their Phone number as ";

$hint=$hint.'<a href="'.$basedir.'/Lab/SearchLab.php?action=phonenumber&pn='.$rowdy['Tp_Number'].'" class="searchlinks">'.$rowdy['Tp_Number'].'</a><br/>';
}

$hint=$hint.'</font>';
}
if($hint==''||$hint=="<br/><font color='black'>")
{
echo $hint."<br/>";
$response='<font class="err"><img src="../images/alert.jpg" width="12" height="12"/> There are no results found for this Lab Id!</font>';
}
else
{
$response=$hint;
}
echo $response;
?>